From 404f18da62e3708c9b290ee4eaf8461911df5475 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Thu, 22 Aug 2019 10:50:21 +0800
Subject: [PATCH] configure.ac: add option for libcap

Upstream-Status: Pending

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Changqing Li <changqing.li@windriver.com>

Fetch from: http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Upstream: https://github.com/FreeRADIUS/freeradius-server/pull/4632
---
 configure.ac | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index c72511ab39..de016b28e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -941,6 +941,22 @@ fi
 dnl Set by FR_SMART_CHECKLIB
 LIBS="${old_LIBS}"
 
+dnl #
+dnl #  extra argument: --with-libcap
+dnl #
+WITH_LIBCAP=yes
+AC_ARG_WITH(libcap,
+[  --with-licap          use licap for debugger checks. (default=yes)],
+[ case "$withval" in
+  no)
+    WITH_LIBCAP=no
+    ;;
+  *)
+    WITH_LIBCAP=yes
+    ;;
+  esac ]
+)
+
 dnl Check for cap
 dnl extra argument: --with-cap-lib-dir=DIR
 cap_lib_dir=
@@ -974,15 +990,17 @@ AC_ARG_WITH(cap-include-dir,
       ;;
   esac])
 
-smart_try_dir="$cap_lib_dir"
-FR_SMART_CHECK_LIB(cap, cap_get_proc)
-if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
-  AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
-else
-  AC_DEFINE(HAVE_LIBCAP, 1,
-    [Define to 1 if you have the `cap' library (-lcap).]
-  )
-  HAVE_LIBCAP=1
+if test "x$WITH_LIBCAP" = xyes; then
+  smart_try_dir="$cap_lib_dir"
+  FR_SMART_CHECK_LIB(cap, cap_get_proc)
+  if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
+    AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
+  else
+    AC_DEFINE(HAVE_LIBCAP, 1,
+      [Define to 1 if you have the `cap' library (-lcap).]
+    )
+    HAVE_LIBCAP=1
+  fi
 fi
 
 dnl #
-- 
2.17.1

